package com.gtw.interpreter;

import java.util.HashMap;

/**
 * 非终结符表达式代表一个文法规则,每个文法规则都只关心自己周边的文法规则的法则
 */
public class SubExpression extends Expression {

    private Expression left;
    private Expression right;

    public SubExpression(Expression left, Expression right) {
        this.left = left;
        this.right = right;
    }

    public int interpret(HashMap<String, Integer> var) {
        return left.interpret(var) - right.interpret(var);
    }
}
